package com.zretc.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader.Array;
import com.zretc.dao.AreaDao;
import com.zretc.entity.Area;
import com.zretc.util.DBUtil;

/**
 * Area地区dao实现类
 * @author Administrator
 *
 */
public class AreaDaoImpl implements AreaDao{

	@Override
	public List<Area> findArea() {
		List<Area> list =new ArrayList<>();
		Area area = null;
		ResultSet rs = DBUtil.doQuery("select area_id,area_name from area");
		
		try {
			while (rs.next()) {
				int areaId = rs.getInt("area_id");
				String areaName = rs.getString("area_name");
				area = new Area(areaId, areaName);
				list.add(area);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return list;
	}

}
